<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="./js/react.development.js"></script>
  <script src="./js/react-dom.development.js"></script>
  <script src="./js/babel.min.js"></script>
</head>

<body>
  <div id="app"></div>
  <script type="text/babel">
    let arr = [
      { name: "张三111", age: 20, hobby: "篮球", color: "red", isshowhobby: true },
      { name: "张三222", age: 21, hobby: "足球", color: "yellow", isshowhobby: false },
      { name: "张三333", age: 22, hobby: "排球", color: "pink", isshowhobby: true },
    ]
    let res = arr.map((item, index) =>
      <li key={index} style={{ color: item.color, display: item.isshowhobby ? "block" : "none" }}>
        姓名:{item.name}, 年龄：{item.age}, {item.isshowhobby ? `爱好:${item.hobby}` : ""}
      </li>)
    let vdom = <div>
      {res}
    </div>
    console.log(vdom);
    let root = ReactDOM.createRoot(document.querySelector("#app"))
    root.render(vdom)

  </script>
</body>

</html>